<?php

include_once("../../config.php");
include_once("../../db_connect.php");
//include_once("../../restrito.php");

//pegar o id do evento ativo na sessao
if(isset($_SESSION["eventoAtivo"])){
	$eventoAtivo = unserialize($_SESSION["eventoAtivo"]);
}

$operacao = "Palestrantes";

//pegar objeto da sessao
$palestrante = unserialize($_SESSION["palestrante"]);

if($palestrante->getId() != ""){
	$dica = "Editando palestrante";
}else{
	$dica = "Cadastrando novo palestrante";
}

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Eventos Acadêmicos</title>
<link href="blueprint/screen.css" rel="stylesheet" type="text/css" media="all" />
<link href="http://code.jquery.com/ui/1.10.0/themes/base/jquery-ui.css" rel="stylesheet" type="text/css" media="all" />
<link href="css/style.css" rel="stylesheet" type="text/css" media="all" />
<script src="http://code.jquery.com/jquery-1.9.0.js"></script>
<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.0/jquery.validate.js" ></script>
<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/additional-methods.js" ></script>
<script src="http://code.jquery.com/ui/1.10.0/jquery-ui.js"></script>

<script src="js/functions.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
        $('#form-questionario').validate({
            rules:{
                nome:{
                    required: true,
                    minlength: 3
                },
				email:{
                    required: true,
                    email: true
                },
                curriculum:{
					required: true
                },
				foto: {
					  accept: "image/*",
					  filesize: 1048576
					}
            },
            messages:{
                nome:{
                    required: "O campo nome é obrigatório.",
                    minlength: "O campo nome deve conter no mínimo 3 caracteres."
				},
				email:{
                    required: "O campo email é obrigatório.",
                    email: "Informe um email válido."
                },
				curiculum:{
					required: "O campo curriculum é obrigatório."
				},
				foto: {
					  accept: "Apenas imagens são permitidas.",
					  filesize: "Imagem muito grande. Tamanho máximo 1MB."
					}
            }
 
        });
    });
</script>
</head>

<body>

<!--<div id="mask"></div>-->

<div id="wrapper">

<div id="header">
	<div id="logo_instituicao">
    	<img src="<?php echo $logo_instituicao; ?>" alt="Logo" />
    </div>
    <div id="logo_sistema">
    	<img src="<?php echo $logo_sistema; ?>" alt="Ambiente Online" />
    </div>
</div>
<div id="content">
	<div id="sidebar">
    	<?php include("user_info_inc.php"); ?>
        <?php loadMenu("evento");?>
    </div>
    <div id="main_content">
   	    <div id="notifications">
   	  		<?php include("notification_inc.php"); ?>
   	  	</div>
      



<div id="boxTitlePage">
	<span class="title"><?php echo utf8_encode( $eventoAtivo->getNome() ). " > " .$operacao; ?></span>
	<span><?php echo $dica;?></span>
</div>

<?php
            if($palestrante->getFoto() != ""){
				echo '<img src="images/fotos/'.$palestrante->getFoto().'" alt="Foto" width="96" height="96" style="border-radius: 100px;"/><br />';
			}else{
				echo '<img src="avatar.jpg" alt=""  style="border-radius: 100px;"/><br />';
			}
            ?>

<form action="../controller/palestranteController.php" id="form-questionario" method="post" enctype="multipart/form-data">
            <input type="hidden" name="eventoId" value="<?php echo $eventoAtivo->getId(); ?>"/>
        	<input type="hidden" name="id" value="<?php echo $palestrante->getId(); ?>"/>
            <input type="hidden" name="action" value="save"/>
            
            <label for="nome">Nome</label><br />
            <input type="text" value="<?php echo utf8_encode( $palestrante->getNome() );?>" name="nome" id="nome"/><br />
        	
        	<label for="email">Email</label><br />
            <input type="text" value="<?php echo utf8_encode( $palestrante->getEmail() );?>" name="email" id="email"/><br />
            
            <label for="telefone">Telefone</label><br />
            <input type="text" value="<?php echo utf8_encode( $palestrante->getTelefone() );?>" name="telefone" id="telefone"/><br />
            
            <label for="curriculum">Curriculum</label><br />
            <textarea rows="10" cols="10" name="curriculum"><?php echo utf8_encode( $palestrante->getCurriculum() );?></textarea><br />
            
            <label for="linkLattes">Link Lattes</label><br />
            <input type="text" value="<?php echo utf8_encode( $palestrante->getLinkLattes() );?>" name="linkLattes" id="lattes"/><br />
            
            <br />            
            
            <label for="foto">Foto</label><br />
            <input type="file" name="foto" id="foto"/><br />
            
            <br /><br />
            
                    
        	
        	<div id="barra_botoes">
            	<button class="botaoGoogleBlue float-right" type="submit" name="enviar">Salvar</button>
            	<button class="botaoGoogleBlue float-right" type="reset" name="cancelar">Cancelar</button>        	        
            </div>
            <div class="clear"></div>
            </form>
        
        
    </div>
</div>
<div id="footer">
	<div id="developers">
    	<img src="<?php echo $logo_developer; ?>" />
    </div>
    <div id="footer_address">
    	<?php echo $nome_faculdade_completo; ?><br />
        <?php echo $endereco_faculdade; ?>
    </div>
</div>
</div><!-- fecha wrapper-->

</body>
</html>
